package com.example.commonmistak.apidesign.common;

import lombok.Getter;

/**
 * @author xionggg
 * @date 2022/2/2 08:52
 */
public class ApiException extends RuntimeException {
    @Getter
    private int errorCode;
    @Getter
    private String errorMessage;

    public ApiException(int errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }
    public ApiException(ExceptionEnum exceptionEnum) {
        super(exceptionEnum.getMessage());
        this.errorCode = exceptionEnum.getCode();
        this.errorMessage = exceptionEnum.getMessage();
    }
}
